package org.jground.rxapps.dev;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jground.rx.RXSystem;
import org.jground.rx.gen.JavaClassGenerator;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.FileSystemResource;

public class GenerateJavaClasses {
	private static Log   logger = LogFactory.getLog(GenerateJavaClasses.class);

	/**
	 * @param args
	 * @throws Exception
	 */
	// public static void main(String[] args) throws Exception {
	// // INITIALIZE ENVIRONMENT
	// Log log = LogFactory.getLog(GenerateJavaClasses.class);
	// //
	// CodetableFactory.initialize(DevConstants.rxDefinitionsDirs);
	// //
	// RXService rxService = new RXService(DevConstants.rxDefinitionsDirs);
	// rxService.setAsInstance(true);
	// RXService.getInstance();
	// //
	// JavaCodetableClassGenerator.processJavaClassGeneration(DevConstants.codetableFullClassName,
	// DevConstants.generatedCodeOutputDir);
	// JavaClassGenerator.processJavaClassGeneration(DevConstants.generatedCodeOutputDir);
	// YUMLGenerator gen1 = new YUMLGenerator("org.jground.rx.def.apps.ipm",
	// "org.jground.rx.def.apps.legal", "org.jground.rx.def.apps.cip");
	// gen1.process("yumlscript.txt", false);
	// gen1.setNoInheritance(true);
	// gen1.setNoRelation(true);
	// gen1.setColor("org.jground.rx.def.apps.ipm", "red");
	// gen1.setColor("org.jground.rx.def.apps.cip", "green");
	// gen1.process("yumlscript-class.txt", false);
	// gen1.setNoInheritance(false);
	// gen1.setNoRelation(false);
	// gen1.setColor("org.jground.rx.def.apps.ipm", "yellow");
	// gen1.setColor("org.jground.rx.def.apps.cip", "gray");
	// gen1.process("yumlscript-all.txt", false);
	// // insert result in yuml.me ...
	//
	// log.info("DONE");
	// }

	public static void main(String[] args) throws Exception {
		BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
				"src/config/rxAC-gen.xml"));
		RXSystem rxSystem = (RXSystem) factory.getBean("rxSystem");
		JavaClassGenerator classGenerator = (JavaClassGenerator) factory
				.getBean("codeGenerator");
		logger.info("rxSystem:" + rxSystem);
		logger.info("classGenerator:" + classGenerator);
		System.out.println("*** DONE ***");
	}

}
